package com.xmb.wechat.dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import com.xmb.wechat.R;
import com.xmb.wechat.definterface.WhoSendListener;

import java.util.Objects;

/**
 * @Author lijiangop
 * @CreateTime 2020/3/25 16:47
 */
public class ChangeFontSizeHintDialog extends Dialog {

    public ChangeFontSizeHintDialog(@NonNull Context context, WhoSendListener whoSendListener) {
        super(context, R.style.PopupDialog);
        initView(context,whoSendListener);
    }

    private void initView(Context context, WhoSendListener whoSendListener) {
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_change_font_size_hint, null, false);
        view.findViewById(R.id.tv_other).setOnClickListener(v -> {
            if (whoSendListener!=null)
                whoSendListener.onOther();
            dismiss();
        });
        view.findViewById(R.id.tv_me).setOnClickListener(v -> {
            if (whoSendListener!=null)
                whoSendListener.onMe();
            dismiss();
        });
        setContentView(view);
        WindowManager.LayoutParams lp = Objects.requireNonNull(getWindow()).getAttributes();
        lp.dimAmount = 0.5f;
        getWindow().setAttributes(lp);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    }
}
